﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlDoiGiaHangBan.ascx.cs" Inherits="UserControl_ControlDoiGiaHangBan" %>

 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
 <%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>

<style type="text/css">
        .AutoExtender
        {
            font-family: Verdana, Helvetica, sans-serif;
            font-size: .8em;
            font-weight: normal;
            border: solid 1px #006699;
            line-height: 20px;
            padding: 10px;
            background-color: White;
            margin-left:10px;
            width: 300px;
        }
        .AutoExtenderList
        {
            border-bottom: dotted 1px #006699;
            cursor: pointer;
            color: Maroon;
        }
        .AutoExtenderHighlight
        {
            color: White;
            background-color: #006699;
            cursor: pointer;
        }
        #divwidth
        {
         width: auto !important;    
        }
        #divwidth div
       {
        width: auto !important;   
       }
       #divwidthMaHangInput
       {
       	width: auto !important;  
       }
        #divwidthMaHangInput div
       {
       	width: auto !important;  
       } 
       
 </style>



<script type="text/javascript">
    function pageLoad() {

  

        //Lấy ngày workingday
        $.ajax({
            type: "POST",
            url: '<%=ResolveUrl("~/Webservice/WebServiceDRM.asmx/GetWorkingDay")%>',
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                $("#<%= txtDate.ClientID %>").datePicker(
		           {
		            clickInput: true,
		            startDate: data.d
		           });
            }
        });

   

        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= btnSave.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= btnDelete.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        
    $("#<%= ImgBtnRequest.ClientID %>").click(function () {
        $.blockUI({ css: {
            border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
        }
        });
    });
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args) {
        $.unblockUI();
    }

    }
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
     <div class="direct_container_right_titletop">
                     Đổi giá hàng bán
                </div>
                 <hr />
                <!-- Button chuc nang-->
                <div class="direct_container_main">
                    <asp:ImageButton ID="imgBtnAdd" ToolTip="Tạo mới mghiệp vụ" onclick="imgBtnAdd_Click" CausesValidation="false" ImageUrl="~/Images/add.png" Width="32px" Height="32px" runat="server" />
                    <%--<asp:ImageButton ID="imgBtnSave" ToolTip="Lưu nghiệp vụ" onclick="imgBtnSave_Click" ImageUrl="~/Images/save.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnDelete" ToolTip="Xóa nghiệp vụ" onclick="imgBtnDelete_Click" ImageUrl="~/Images/delete.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnFind" ToolTip="Chuyển qua tab tìm kiếm" onclick="imgBtnFind_Click" CausesValidation="false" ImageUrl="~/Images/find.png" Width="32px" Height="32px" runat="server" />--%>
                    <div style="display:none">
                        <asp:Button ID="btnDefault" runat="server" Text="Default" onclick="btnDefault_Click"/>
                    </div>                        

                </div>
                <!-- End Button chuc nang-->
                <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" 
            BackColor="#CCFFFF" Font-Names="Arial"  
            Width="100%">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập thông tin" TabIndex="0">
                 <ContentTemplate>
                    <!-- Content main-->
                <div class="direct_container_main">
                    <div class="direct_container_form_right">
                        <table border="0" width="100%">
                        
                            <tr>
                                <td colspan="4" align="center">
                                    <asp:Label ID="lblMsg" runat="server" Visible="false" BackColor="Silver" ForeColor="Blue" Font-Bold="true" Font-Italic="true"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="right"><p class="direct_label">Số NV</p></td>
                                <td align="left">
                               <asp:TextBox ID="txtSoNV" ReadOnly="True" CssClass="input_code" 
                                        runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td align="right"><p class="direct_label">Ngày hiệu lực</p></td>
                                <td align="left">
                                    <asp:TextBox ID="txtDate" CssClass="input_code" runat="server"></asp:TextBox>
                                
                                    <asp:Button ID="btnSave" runat="server" Text="Lưu" onclick="btnSave_Click"/>
                                    
                                    <asp:Button ID="btnDelete" runat="server" Text="Xóa" onclick="btnDelete_Click"/>
                                </td>
                            </tr>
                         </table>
                         <div>       
                           
                            <asp:GridView ID="grvProduct" runat="server" AutoGenerateColumns="False" 
                                onrowcancelingedit="grvProduct_RowCancelingEdit" ShowFooter="true"
                                onrowediting="grvProduct_RowEditing" onrowupdating="grvProduct_RowUpdating" 
                                OnPageIndexChanging="grvProduct_PageIndexChanging" AllowPaging="true" PageSize="20"
                                onrowdeleting="grvProduct_RowDeleting" DataKeyNames="Mã hàng" EnableModelValidation="True"><Columns>
                                <asp:TemplateField HeaderText="Stt">
                                    <HeaderTemplate>STT</HeaderTemplate>
                                    <ItemTemplate><%# Container.DataItemIndex + 1 %></ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Mã hàng">
                                    <HeaderTemplate>Mã hàng</HeaderTemplate>
                                    <ItemTemplate>                                                                                                       
                                        <asp:Label ID="lblMaHang" runat="server" Text='<%# Eval("Mã hàng")%>'></asp:Label>                                                                                                    
                                    </ItemTemplate>                                    
                                    <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    <FooterTemplate>
                                        <asp:TextBox ID="txtMaHangInput" runat="server" Width="97%" AutoPostBack="true" TabIndex="5" OnTextChanged="txtMaHangInput_TextChanged"></asp:TextBox>
                                        <div id="divwidthMaHangInput" style="overflow:scroll;height:120px;display:none"></div>
                                        <cc1:AutoCompleteExtender ID="txtMaHangInput_AutoCompleteExtender" 
                                            runat="server"
                                            ServiceMethod="GetMatHangInfo" ServicePath="~/Webservice/WebServiceDRM.asmx" 
                                            TargetControlID="txtMaHangInput"
                                            MinimumPrefixLength="1" 
                                            CompletionInterval="10"
                                            EnableCaching="True"
                                            CompletionSetCount="12"                             
                                            CompletionListCssClass="AutoExtender"
                                            CompletionListItemCssClass="AutoExtenderList"
                                            CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                            CompletionListElementID="divwidthMaHangInput">
                                        </cc1:AutoCompleteExtender>
                                                                               
                                    </FooterTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tên hàng">
                                    <HeaderTemplate>Tên hàng</HeaderTemplate>
                                    <ItemTemplate>                 
                                        <asp:Label ID="lblTenHang" runat="server" Text='<%# Eval("Tên hàng")%>'></asp:Label>                                                                
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                    <FooterTemplate>
                                        <asp:Label ID="lblTenHangInput" runat="server" ></asp:Label>                                            
                                    </FooterTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Giá cũ">
                                    <HeaderTemplate>Giá cũ</HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblGiaCu" runat="server" Text='<%# Eval("Giá cũ")%>'></asp:Label>                                             
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                    <FooterTemplate>
                                        <asp:Label ID="lblGiaCuInput" runat="server" ></asp:Label>                                            
                                    </FooterTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Giá mới">
                                    <HeaderTemplate>Giá mới</HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblGiaMoi" runat="server" Text='<%# Eval("Giá mới")%>'></asp:Label>                                                     
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtGM" CssClass="input_code" Text=' <%# Eval("Giá mới")%>' runat="server"></asp:TextBox>
                                        <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" 
                                            runat="server" Enabled="True" FilterType="Numbers" TargetControlID="txtGM">
                                        </cc1:FilteredTextBoxExtender>
                                    </EditItemTemplate>
                                    <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
                                    <FooterTemplate>
                                        <asp:TextBox ID="txtGMInput" runat="server" AutoPostBack="True" 
                                            ontextchanged="txtGMInput_TextChanged" Width="97%"></asp:TextBox>
                                        <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtenderGMInput" 
                                            runat="server" Enabled="True" FilterType="Numbers" 
                                            TargetControlID="txtGMInput">
                                        </cc1:FilteredTextBoxExtender>
                                    </FooterTemplate>
                                </asp:TemplateField>
                                
                                <%--<asp:CommandField CausesValidation="False" HeaderText="Sửa" 
                                    ShowEditButton="True" ButtonType="Image"
                                    EditImageUrl="~/images/repair_bt.png" EditText="Sửa" 
                                    CancelImageUrl="~/images/exit_bt.png" CancelText="Thoát" UpdateText="Cập nhập" 
                                    UpdateImageUrl="~/images/update_bt.png" >
                                    <ControlStyle Height="25px" Width="25px" />
                                    <ItemStyle Height="25px" Width="25px" />                                    
                                </asp:CommandField>--%>
                                
                                <asp:TemplateField ShowHeader="True" HeaderText="Sửa" HeaderStyle-Width="16px" HeaderStyle-HorizontalAlign="Center">
                                                    <EditItemTemplate>
                                                    <div align="right">
                                                        <asp:LinkButton ID="LinkButtonUpdate" runat="server"
                                                            CausesValidation="false" CommandName="Update">
                                                            <asp:Image ID="imgUpdate" runat="server"
                                                                ImageUrl="~/images/update_bt.png"
                                                                AlternateText="Cập nhật" Width="25px" />
                                                        </asp:LinkButton>
                                                        <asp:LinkButton ID="LinkButtonCancel" runat="server"
                                                            CausesValidation="False" CommandName="Cancel">
                                                            <asp:Image ID="imgCancel" runat="server"
                                                                 ImageUrl="~/images/exit_bt.png"
                                                                 AlternateText="Hủy bỏ" Width="25px" />
                                                        </asp:LinkButton>
                                                    </div>
                                                    </EditItemTemplate>
                                                    <ItemTemplate>
                                                    <div align="right">
                                                        <asp:LinkButton ID="LinkButtonEdit" runat="server" 
                                                            CausesValidation="False" CommandName="Edit">
                                                            <asp:Image ID="imgEdit" runat="server"
                                                                 ImageUrl="~/images/repair_bt.png"
                                                                 AlternateText="Sửa" />
                                                        </asp:LinkButton>
                                                    </div>
                                                    </ItemTemplate>
                                                    <FooterStyle VerticalAlign="Top" />
                                                    <HeaderStyle Width="16px" />
                                                    <FooterTemplate>
                                                    <div align="right">                                                        
                                                        <asp:Button ID="btnAddItem" runat="server" Text="Thêm" CausesValidation="true" CommandName="AddRow" onclick="btnAddItem_Click"/>
                                                    </div>
                                                    </FooterTemplate>
                                                    <ItemStyle Width="20px" />
                                                </asp:TemplateField>
                                
                                <asp:CommandField  ButtonType="Image" DeleteText="Xóa" 
                                    DeleteImageUrl="~/images/delete.png" CausesValidation="False" HeaderText="Xóa" 
                                    ShowDeleteButton="True" >
                                    <ControlStyle Height="25px" Width="25px" />
                                    <ItemStyle Height="25px" Width="25px" />
                                </asp:CommandField>
                            </Columns>
                        </asp:GridView>
                        <div style="height:150px"></div>                        
                      </div>       
                             
                    </div>
                </div>
                <!-- EndContent main-->
            </ContentTemplate>
            </cc1:TabPanel>
             <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Tìm kiếm" TabIndex="1">
                <ContentTemplate>
                         <!-- Content search -->
                <div class="direct_container_main">
                     <div class="direct_container_form_right">
                         <table border="0" width="100%">
                                    <tr>
                                        <td colspan="4">
                                            <asp:ImageButton ID="ImgBtnRequest" ToolTip="Cập nhật kết quả tìm kiếm" onclick="ImgBtnRequest_Click" CausesValidation="false" ImageUrl="~/Images/Refresh.png" Width="32px" Height="32px" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                        
                                        <asp:GridView ID="grvSearch" runat="server" PageSize="10" AutoGenerateColumns="False" 
                                                        DataKeyNames="docno" EnableModelValidation="True" onpageindexchanging="grvSearch_PageIndexChanging"
                                                        onrowcommand="grvSearch_RowCommand">
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Stt">
                                                                <HeaderTemplate>
                                                                    STT
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Số nghiệp vụ">
                                                                <HeaderTemplate>
                                                                    Số nghiệp vụ
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                   
                                                                    <asp:Label ID="lblSoNV" runat="server" Text='<%# Eval("docno")%>'></asp:Label>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Ngày chứng từ">
                                                                <HeaderTemplate>
                                                                    Ngày chứng từ
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Eval("docdate")%>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                            </asp:TemplateField>
                                                           
                                                             <asp:TemplateField>
                                                                 <ItemTemplate>
                                                                    <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" 
                                                                    CommandName="chon" Height="25px" Width="25px" ImageUrl="~/Images/check.png" />
                                                                </ItemTemplate>
                                                                <ControlStyle BackColor="White" BorderColor="White" />
                                                                <FooterStyle BackColor="White" BorderColor="White" />
                                                                <HeaderStyle BackColor="White" BorderColor="White" />
                                                                <ItemStyle BackColor="White" BorderColor="White" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                    </asp:GridView>
                                        
                                        </td>
                                    </tr>


                         </table>
                    </div>

                </div>
                <!-- End Content search -->
           </div>
                </ContentTemplate>
            </cc1:TabPanel>
            </cc1:TabContainer>
            <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True"></dxpc:PopupControlContentControl>
</ContentCollection>
    </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>
